package p2000;

import java.util.Scanner;

public class Main2014青年歌手大奖赛_评委会打分 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextInt()) {
            int n = scanner.nextInt();
            int a = scanner.nextInt();
            int min = a, max = a, sum = a, total = n;
            while (n-- > 1) {
                a = scanner.nextInt();
                if (min > a) {
                    min = a;
                }
                if (max < a) {
                    max = a;
                }
                sum += a;
            }
            sum = sum - max - min;
            double result = (double) sum / (double) (total - 2);
            System.out.println(String.format("%.2f", result));
        }
    }

}
